package com.mq;

import com.mq.service.BlogService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;

public class TEST {
	@Autowired
	private BlogService blogService;

	@Test
	 public void test(){
		ApplicationContext applicationContext =new ClassPathXmlApplicationContext("applicationContext.xml");
		DataSource dataSource =(DataSource) applicationContext.getBean("dataSource");
		try {
			Connection connection=dataSource.getConnection();
			System.out.println(connection);
		} catch (SQLException throwables) {
			throwables.printStackTrace();
		}


	}
}
